<!--审核设计审核页面-->
<script type="text/html" id="barDemo">
    <a href="#" class="layui-btn layui-btn-xs" lay-event="edit">下载</a>
</script>
<div class="layui-inline">
    <div class="layui-input-inline">
        <input class="layui-input" name="search_input" id="search_input" autocomplete="off" placeholder="请输入学号或者题目进行搜索">
    </div>

</div>
<button class="layui-btn" data-type="reload">搜索</button>
<table id="check_design" class="layui-hide" lay-filter="check_design"></table>

<script>
    layui.use(['table','layer'], function() {
        var $ = layui.jquery,
            table = layui.table,
            layer = layui.layer;

        table.render({
            id:'check_design_table'
            ,elem: '#check_design'
            ,url:'/api/v1/teacher/designs'
            ,method:'GET'
            ,parseData: function (res) {
                return {
                    "code": res.code,
                    "msg": res.msg,
                    "count": res.data.total,
                    "data": res.data.list
                };
            }
            ,cols: [[
                {checkbox: true, fixed: true}
                ,{width:60, title: '序号',type:'numbers'}
                ,{field:'id', width:80, title: '序号', sort: true,hide:true}
                ,{field:'studentId', width:114, title: '学号'}
                ,{field:'fileName', width:213, title: '文件名称'}
                ,{width:292, title: '所选题目',templet:function(d){
                    return d.title.titleName;
                    }}
                ,{field:'uploadTime', width:168, title: '上传时间', sort: true}
                ,{field:'status', width:89, title: '文件状态'}
                ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:90}
            ]]
            ,page: true
        });

        // 监听每一行的工具条
        table.on('tool(check_design)', function(obj){
            let data = obj.data;
            let layEvent = obj.event;
            if(layEvent == 'edit'){
               window.location.href="/api/v1/teacher/design/"+data.studentId;
               setTimeout(()=>{
                   table.reload('check_design_table')
               },2000);
            }
        });
    });

</script>